#ifdef GL_ES
precision mediump float;
#endif

uniform float u_time;
uniform vec2 u_resolution;
uniform vec2 u_mouse;

float plot(float x,float y){
    return smoothstep(0.0,0.02,abs(y - x));
}

// 移动的一个正弦波
const float PI = 3.14159;
void main() {

    vec2 st = gl_FragCoord.xy/u_resolution;
    // st.x *= u_resolution.x/u_resolution.y;

    float y = st.y;
    float x =  0.5 * sin((st.x + u_time)  * PI * 2.0) + 0.5;
    float pct = plot(x,y);

    vec3 green = vec3(0.0,1.0,0.0);
    vec3 bgColor = vec3(0.0);
    vec3 finalColor = pct * bgColor + (1.0 - pct) * green;
    gl_FragColor = vec4(finalColor,1.0);
}

